///////////////////////////////page_rentalCarOrderDetails//////////////////////
$(document).on("pageInit", "#page_rentalCarOrderDetails", function(e, pageId, $page) {
                    my.givetitle('租车订单详细');
	                $.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
      			    var car_place=''
      			    var start_time=''
      			    var end_time=''
      			    var user_carid=''
      	    	    $('.CROD-xc-toggle').click(function(){
						$('.CROD-xc').toggle()
					})

/*进入页面获取定单详情开始****************************************************************************/
                    var info={order_id:sessionStorage.orderid}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.userorderinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("订单详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{

      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    user_carid=data.info.usercar_id
      								    car_place=data.info.parking_place
      								    start_time=data.info.order_startime
      								    end_time=data.info.order_endtime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.usercar_nickname)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.order_startime.substr(0,16))
      								    $('.order_endtime').text(data.info.order_endtime.substr(0,16))
      								    $('.workday_price').text(config.danwei+data.info.workday_price+' * '+data.info.workday_num)
      								    $('.weekend_price').text(config.danwei+data.info.weekend_price+' * '+data.info.weekend_num)
      								    $('.holiday_price').text(config.danwei+data.info.holiday_price+' * '+data.info.holiday_num)
      								    $('.store_private_price').text(config.danwei+data.info.store_private_price)
      								    $('.limit_carid_price').text(config.danwei+data.info.limit_carid_price+' * '+data.info.limit_num)
      								    $('.weixiu_total').text(config.danwei+data.info.weixiu_total)
      								    $('.weizhang_total').text(config.danwei+data.info.weizhang_total)
      								    $('.insurance_price').text(config.danwei+data.info.insurance_price+' * '+data.info.insurance_num)
      								    $('.weiyue_total').text(config.danwei+data.info.weiyue_total)
      								    $('.ewai_total').text(config.danwei+data.info.ewai_total)
      								    $('.order_total').text(config.danwei+data.info.order_total)
      								    for(v in data.flow){
      								    	var step='<div id="'+v+'"><span>'+data.flow[v]+'</span><img src="/h5car/img/icon/zjt.png"></div>'
      								    	$('.CROD-xc-rentalCalOrderDetails').append(step)
      								    }
      								    $('.map_stores_name').text(data.info.stores_name)
      								    $('.map_stores_name_re').text(data.info.stores_name_re)
      								    $('.qc-url').attr('href',picmapUrl+'?baidu_longitude='+data.info.baidu_longitude+'&baidu_atitude='+data.info.baidu_atitude+'&stores_phone='+data.info.stores_phone+'&stores_address='+escape(data.info.stores_address)+'&stores_name='+escape(data.info.stores_name))
      								    $('.hc-url').attr('href',picmapUrl+'?baidu_longitude='+data.info.baidu_longitude_re+'&baidu_atitude='+data.info.baidu_atitude_re+'&stores_phone='+data.info.stores_phone_re+'&stores_address='+escape(data.info.stores_address_re)+'&stores_name='+escape(data.info.stores_name_re))
      								    $('#'+data.info.now_id).css('color','#000')
      								    if(data.info.order_state>=8){
      								    	$('.xgcs').hide()
      								    }else{
      								    	$('.xgcs').show()
      								    }
      								    if(data.info.order_state>=6){
      								    	$('.qxdd').hide()
      								    }else{
      								    	$('.qxdd').show()
      								    }
//    								    if(data.info.waitfp_status==0){
//    								    	$('.waitfp_status').text('待支付订单预定 '+data.info.waitfp_cost+config.danwei).attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_cost=data.info.waitfp_cost
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//                  	                        $.router.loadPage("zhifu_other.html");
//    								    	})
//    								    }else if(data.info.waitfp_status==1){
//    								    	$('.waitfp_status').text('已支付订单预定 '+data.info.waitfp_cost+config.danwei).removeClass('btn-zf').attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//    								    		sessionStorage.ewtype=4
//                  	                        $.router.loadPage("otherCostdetails.html");
//    								    	})
//    								    }
      								    if(data.info.orderyajin_show==1){
      								    	if(data.info.is_depositpay==1){
      								    	     $('.orderyajin_show').show().text('已支付订单押金'+config.danwei+data.info.order_deposit).removeClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
      								    	     	sessionStorage.yjtype=1
      								                $.router.loadPage("depositCostDetails.html")
      								    	    })
      								    	 }else if(data.info.is_depositpay==0){
      								    	 	 $('.orderyajin_show').show().text('待支付订单押金'+config.danwei+data.info.order_deposit).addClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
                    	                            sessionStorage.zftype=1
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }

      								    }else if(data.info.orderyajin_show==0){
      								    	$('.orderyajin_show').hide()
      								    }
      								    if(data.info.weizhang_show==1){
      								    	if(data.info.is_legalpay==1){
      								    	     $('.weizhang_show').show().text('已支付违章押金'+config.danwei+data.info.legal_deposit).removeClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
      								    	     	sessionStorage.yjtype=2
      								                $.router.loadPage("depositCostDetails.html")
      								    	    })
      								    	 }else if(data.info.is_legalpay==0){
      								    	 	 $('.weizhang_show').show().text('待支付违章押金'+config.danwei+data.info.legal_deposit).addClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
                    	                         sessionStorage.zftype=2
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }

      								    }else if(data.info.weizhang_show==0){
      								    	$('.weizhang_show').hide()
      								    }
      								    if(data.info.quche_state==1){

      								    	$('.quche_state').show()

      								    }else if(data.info.quche_state==0){

      								    	$('.quche_state').hide()
      								    	//$('.quche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.huanche_state==1){
      								    	$('.huanche_state').show()
      								    }else if(data.info.huanche_state==0){

      								    	$('.huanche_state').hide()
      								    	//$('.huanche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.zhifu_count!=0){
      								    	$('.zf-btn-list').empty()
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'" title="'+data.zhifu_button[i].waitfp_cost+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
      								    		sessionStorage.waitfp_cost=$(this).attr('title')
                    	                        //$.router.loadPage("zhifu_other.html");
                                                $.router.load(zhifu_otherUrl,true);
      								    	})
      								    	$('.zfxm-xq').click(function(){
      								    		sessionStorage.ewtype=4
      								    		sessionStorage.waitfp_id=$(this).attr('id')
                                                $.router.loadPage(otherCostdetailsUrl,true)
      								    		//$.router.loadPage("otherCostdetails.html")
                    	                        //$.router.loadPage("zhifu_other.html");
      								    	})
      								    }


      						}
      					}
      				})
/*进入页面获取定单详情结束****************************************************************************/

/*取车验车点击开始***********************************************************************************/
                    $('.quche_state').click(function(){
                    	sessionStorage.yctype=2;
                        $.router.loadPage(carCheckDetailsQucheUrl,true);
                    });
                    $('.huanche_state').click(function(){
                    	sessionStorage.yctype=3;
                        $.router.loadPage(carCheckDetailsHuancheUrl,true);
                    });
/*取车验车点击结束***********************************************************************************/

/*修改车时开始**********************************************************************************/
                     var cal_end_Y=end_time.substr(0,4)
                     var cal_end_M=end_time.substr(5,2)-1
                     var cal_end_D=end_time.substr(8,2)
                     var cal_end_H=end_time.substr(11,2)
                     $("#rang-time").datetimePicker({
                            value: [cal_end_Y,cal_end_M+1,cal_end_D,cal_end_H,'00'],
                            onClose:function(){
                            	 $.confirm('确认修改？',
                                   function () {
                                           var info={
      					                              order_id:sessionStorage.orderid,
      					                              user_carid:user_carid,
      					                              car_place:car_place,
      					                              start_time:start_time,
      					                              new_endtime: $("#rang-time").val(),
      				                                 }
		                                   $.showPreloader()
      				                       info=my.cryptoASEencrypt(JSON.stringify(info),key)
      			                           $.ajax({
      					                            url:api.uporderrentdate,
      					                            type: 'post',
      					                            async:true,
      					                            data:{
      						                               'api_value':info
      					                                 },
      					                            error:function(){
      						                                             $.hidePreloader()
      							                                         $.toast("修改租期失败，请重新修改");
      						                                         },
      				                            	success:function(data){
      						                                                 $.hidePreloader()
      						                                                 if(data.match("err_code")!=null){
      							                                                       switch(JSON.parse(data).err_code)
      								                                                   {
      									                                                   case 40003:
      									                                                     my.tokenExpire();
      									                                                     break;
      									                                                   default:
      									                                                     $.toast(JSON.parse(data).err_msg);
      								                                                    }
      							                                              }else{
      								                                                  data=JSON.parse(data)
      								                                                  data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								                                                  console.log(data)
      								                                                  $.modal({
                                                                                                 title: "修改成功",
                                                                                                 text: '<div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">去车车时:</span><span style="float: right;font-size:10px;">'+data.old_begin_time+'</span></div><div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">改为:</span><span style="float: right;font-size:10px;">'+data.new_begin_time+'</span></div><div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">还车车时:</span><span style="float: right;font-size:10px;">'+data.old_end_time+'</span></div><div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">改为:</span><span style="float: right;font-size:10px;">'+data.new_end_time+'</span></div><div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">原租金:</span><span style="float: right;font-size:10px;">'+data.old_price+'</span></div><div style="border-bottom: solid thin #ccc;text-align: left; padding: .2rem;"><span style="font-size:10px;">现租金:</span><span style="float: right;font-size:10px;">'+data.new_price+'</span></div>',
                                                                                                 buttons: [{
                                                                                                 	text: '关闭',
                                                                                                 	 onClick: function() {
                                                                                                         my.reload()
                                                                                                     }
                                                                                                 }]
                                                                                              })


      							                                               }
      					                                 }
      				                });
                                 },
                                 function () {
                                               $("#rang-time").val('修改租期结束时间')
                                             }
                                 );
                            }

                     });
   	    	         $("#rang-time").val('修改租期结束时间')
/*修改车时结束**********************************************************************************/

      	    	    //取消订单开始
      	    	    $('.qxdd').click(function(){
      	    	       $.confirm('确认要取消么？',function(){
      	    	       	$.showPreloader()
      	    	    $('.qxdd').addClass('active_btn')
                    var info_del={
                    	        order_id:sessionStorage.orderid,
                    	        user_id:my.getCookie('id')
                            }
                        info_del=my.cryptoASEencrypt(JSON.stringify(info_del),key)

      				$.ajax({
      					url:api.usercancelorder,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_del
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $('.qxdd').removeClass('active_btn')
      							$.toast("订单取消失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      							}else{
      						     $('.qxdd').removeClass('active_btn')
      						     $.alert('取消成功',function(){
      						         //	$.router.loadPage("rentalCarOrder.html");
                                        $.router.loadPage(rentalCarOrderUrl,true);
      						     })
      						    }
      					}
      				  })

      	    	       })

      			    })
      	    	    //取消订单结束
      	    	     //下拉刷新start
      		    $(document).off('refresh').on('refresh', '.pull-to-refresh-content',function() {
      		    	 //订单详情开始
      		    	  $("#rang-time").val('修改租期结束时间')
                    var info={order_id:sessionStorage.orderid}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.userorderinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("订单详情获取失败");
      						},
      					complete:function(){
      				    	setTimeout(function(){
      				    		 $.pullToRefreshDone('.pull-to-refresh-content')
      				    	},2000)
      				    },
      					success:function(data){
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      							        $.hidePreloader()
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    user_carid=data.info.usercar_id
      								    car_place=data.info.parking_place
      								    start_time=data.info.order_startime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.usercar_nickname)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.order_startime)
      								    $('.order_endtime').text(data.info.order_endtime)
      								    $('.workday_price').text(config.danwei+data.info.workday_price+' * '+data.info.workday_num)
      								    $('.weekend_price').text(config.danwei+data.info.weekend_price+' * '+data.info.weekend_num)
      								    $('.holiday_price').text(config.danwei+data.info.holiday_price+' * '+data.info.holiday_num)
      								    $('.store_private_price').text(config.danwei+data.info.store_private_price)
      								    $('.limit_carid_price').text(config.danwei+data.info.limit_carid_price+' * '+data.info.limit_num)
      								    $('.weixiu_total').text(config.danwei+data.info.weixiu_total)
      								    $('.weizhang_total').text(config.danwei+data.info.weizhang_total)
      								    $('.insurance_price').text(config.danwei+data.info.insurance_price+' * '+data.info.insurance_num)
      								    $('.weiyue_total').text(config.danwei+data.info.weiyue_total)
      								    $('.ewai_total').text(config.danwei+data.info.ewai_total)
      								    $('.order_total').text(config.danwei+data.info.order_total)
      								    if(data.info.order_state>=8){
      								    	$('.xgcs').hide()
      								    }else{
      								    	$('.xgcs').show()
      								    }
      								    if(data.info.order_state>=6){
      								    	$('.qxdd').hide()
      								    }else{
      								    	$('.qxdd').show()
      								    }
      								    console.log(data.info.waitfp_status)
//    								    if(data.info.waitfp_status==0){
//    								    	$('.waitfp_status').text('待支付订单预定 '+config.danwei+data.info.waitfp_cost).attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//                  	                        $.router.loadPage("zhifu_other.html");
//    								    	})
//    								    }else if(data.info.waitfp_status==1){
//
//    								    	$('.waitfp_status').text('已支付订单预定 '+config.danwei+data.info.waitfp_cost).removeClass('btn-zf').attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//    								    		sessionStorage.ewtype=4
//                  	                        $.router.loadPage("otherCostdetails.html");
//    								    	})
//    								    }
      								    if(data.info.orderyajin_show==1){
      								    	if(data.info.is_depositpay==1){
      								    	     $('.orderyajin_show').show().text('已支付订单押金'+config.danwei+data.info.order_deposit).removeClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
      								              $.toast('订单押金详情');
      								    	    })
      								    	 }else if(data.info.is_depositpay==0){
      								    	 	 $('.orderyajin_show').show().text('待支付订单押金'+config.danwei+data.info.order_deposit).addClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
                    	                            sessionStorage.zftype=1
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }

      								    }else if(data.info.orderyajin_show==0){
      								    	$('.orderyajin_show').hide()
      								    }
      								    if(data.info.weizhang_show==1){
      								    	if(data.info.is_legalpay==1){
      								    	     $('.weizhang_show').show().text('已支付违章押金'+config.danwei+data.info.legal_deposit).removeClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
      								              $.toast('违章押金详情');
      								    	    })
      								    	 }else if(data.info.is_legalpay==0){
      								    	 	 $('.weizhang_show').show().text('待支付违章押金'+config.danwei+data.info.legal_deposit).addClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
                    	                             sessionStorage.zftype=2
                    	                          //  $.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }

      								    }else if(data.info.weizhang_show==0){
      								    	$('.weizhang_show').hide()
      								    }
      								    if(data.info.quche_state==1){

      								    	$('.quche_state').show()

      								    }else if(data.info.quche_state==0){

      								    	$('.quche_state').hide()
      								    	//$('.quche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.huanche_state==1){
      								    	$('.huanche_state').show()
      								    }else if(data.info.huanche_state==0){

      								    	$('.huanche_state').hide()
      								    	//$('.huanche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.zhifu_count!=0){
      								    	$('.zf-btn-list div').not('.waitfp_status').remove()
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
                    	                       // $.router.loadPage("zhifu_other.html");
                                                $.router.load(zhifu_otherUrl,true);
      								    	})
      								    	$('.zfxm-xq').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
      								    		sessionStorage.ewtype=4
                    	                        //$.router.loadPage("otherCostdetails.html");
                                                $.router.load(otherCostdetailsUrl,true);
      								    	})
      								    }


      						}
      					}
      				})
                    //订单详情结束
                });//下拉刷新end
                //租金保险
                $('.CROD-yc-head-zjbx').click(function(){
      	    	   	    $('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
						$(this).next('.CROD-yc-head-main').toggle()
				    })
                 //维修费用开始
                $('.CROD-yc-head-wxfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')=='block'){
				    		 //$.showPreloader()
				          $('.table-head-main-wxfy').siblings('.fyxq').show()
      					  $('.table-head-main-wxfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				    $.ajax({
      					  url:api.orderweixiuselect,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    //$.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	//$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wxfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wxfy').empty()
      							$('.table-head-main-wxfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							  var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>车损项目</span><span>'+data.list[i].damage_item+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车损状况</span><span>'+data.list[i].damage_status+'</span></div>'
		 	                              +'<div class="table-head-a"><span>预估维修费</span><span>'+config.danwei+data.list[i].cost+'</span></div>'
		 	                               +'<div class="table-head-a"><span>时间</span><span>'+data.list[i].damage_time+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'

		 	                      $('.table-head-main-wxfy').append(list)
		 	                    }
      						}
      					  }
      						}
      				    })

                	   }
				    })
                 //维修费用结束
                 //违章费用开始
                $('.CROD-yc-head-wzfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
                	$(this).next('.CROD-yc-head-main').toggle()
				   // $(this).next('.CROD-yc-head-main').toggle("normal",function(){
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    	  $('.table-head-main-wzfy').siblings('.fyxq').show()
      					  $('.table-head-main-wzfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)

      				    $.ajax({
      					  url:api.orderselectweiz,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wzfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wzfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wzfy').empty()
      							$('.table-head-main-wzfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违法行为代码</span><span>'+data.list[i].legal_code+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车辆牌照</span><span>'+data.list[i].car_plate+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法时间</span><span>'+data.list[i].legal_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法地点</span><span>'+data.list[i].legal_address+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法金额</span><span>'+config.danwei+data.list[i].legal_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].legal_remark+'</span></div>'
		 	                      $('.table-head-main-wzfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })

                	   }
				    })
                 //违章费用结束
                 //违约费用开始
                $('.CROD-yc-head-wyfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 //$.showPreloader()
				    		  $('.table-head-main-wyfy').siblings('.fyxq').show()
      					  $('.table-head-main-wyfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)

      				    $.ajax({
      					  url:api.orderselectweiy,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wyfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wyfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wyfy').empty()
      							$('.table-head-main-wyfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违约类型</span><span>'+data.list[i].rental_type+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约时间</span><span>'+data.list[i].breach_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约金</span><span>'+config.danwei+data.list[i].breach_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约方</span><span>'+data.list[i].breach_owner+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].breach_remark+'</span></div>'
		 	                      console.log(list)
		 	                      $('.table-head-main-wyfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })

                	   }

                }) //违约费用结束
                //额外费用开始
                $('.CROD-yc-head-ewxm').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    		 $('.table-head-main-ewxm').siblings('.fyxq').show()
      					  $('.table-head-main-ewxm').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)

      				    $.ajax({
      					  url:api.orderselectewai,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-ewxm').siblings('.fyxq').hide()
      							 	$('.table-head-main-ewxm').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-ewxm').empty()
      							$('.table-head-main-ewxm').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>项目名</span><span>'+data.list[i].item_name+'</span></div>'
		 	                              +'<div class="table-head-a"><span>费用</span><span>'+config.danwei+data.list[i].item_cost+'</span></div>'
		 	                              +'<div class="table-head-a"><span>创建时间</span><span>'+data.list[i].item_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].Remark+'</span></div>'
		 	                      $('.table-head-main-ewxm').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })

                	   }

                }) //额外费用结束
})